package com.weberror.frontendmonitoring.performancedata.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 性能数据(Performancedata)表实体类
 *
 * @author cnxym
 * @since 2022-08-17 19:35:45
 */
@TableName(value = "performancedata")
public class Performancedata {
    //性能id
    @TableId(value = "performance_id", type= IdType.AUTO)
    private Integer performanceId;
    //首次渲染时间
    @TableField(value = "performance_fp")
    private Float performanceFp;
    //首次内容渲染时间
    @TableField(value = "performance_fcp")
    private Float performanceFcp;
    //上报类型
    @TableField(value = "performance_type")
    private Float performanceType;
    //DOM阶段渲染耗时
    @TableField(value = "performance_domready")
    private Float performanceDomready;
    //DNS解析耗时
    @TableField(value = "performance_dnstime")
    private Float performanceDnstime;
    //响应数据传输耗时
    @TableField(value = "performance_response")
    private Float performanceResponse;
    //资源加载耗时
    @TableField(value = "performance_resources")
    private Float performanceResources;
    //首包时间耗时
    @TableField(value = "performance_firstpackage")
    private Float performanceFirstpackage;
    //页面完全加载时间
    @TableField(value = "performance_pagefull")
    private Float performancePagefull;
    //上报时间
    @TableField(value = "performance_time")
    private String performanceTime;


    public Integer getPerformanceId() {
        return performanceId;
    }

    public void setPerformanceId(Integer performanceId) {
        this.performanceId = performanceId;
    }

    public Float getPerformanceFp() {
        return performanceFp;
    }

    public void setPerformanceFp(Float performanceFp) {
        this.performanceFp = performanceFp;
    }

    public Float getPerformanceFcp() {
        return performanceFcp;
    }

    public void setPerformanceFcp(Float performanceFcp) {
        this.performanceFcp = performanceFcp;
    }

    public Float getPerformanceType() {
        return performanceType;
    }

    public void setPerformanceType(Float performanceType) {
        this.performanceType = performanceType;
    }

    public Float getPerformanceDomready() {
        return performanceDomready;
    }

    public void setPerformanceDomready(Float performanceDomready) {
        this.performanceDomready = performanceDomready;
    }

    public Float getPerformanceDnstime() {
        return performanceDnstime;
    }

    public void setPerformanceDnstime(Float performanceDnstime) {
        this.performanceDnstime = performanceDnstime;
    }

    public Float getPerformanceResponse() {
        return performanceResponse;
    }

    public void setPerformanceResponse(Float performanceResponse) {
        this.performanceResponse = performanceResponse;
    }

    public Float getPerformanceResources() {
        return performanceResources;
    }

    public void setPerformanceResources(Float performanceResources) {
        this.performanceResources = performanceResources;
    }

    public Float getPerformanceFirstpackage() {
        return performanceFirstpackage;
    }

    public void setPerformanceFirstpackage(Float performanceFirstpackage) {
        this.performanceFirstpackage = performanceFirstpackage;
    }

    public Float getPerformancePagefull() {
        return performancePagefull;
    }

    public void setPerformancePagefull(Float performancePagefull) {
        this.performancePagefull = performancePagefull;
    }

    public String getPerformanceTime() {
        return performanceTime;
    }

    public void setPerformanceTime(Object performanceTime) {
        if (performanceTime instanceof Date) {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date date = (Date) performanceTime;
            this.performanceTime = dateFormat.format(date);
        } else if (performanceTime instanceof Long) {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date date = new Date((Long) performanceTime);
            this.performanceTime = dateFormat.format(date);
        }
    }

}

